#include<iostream>
using namespace std;
const int N = 6e6;
int a[N];
int b[N];
void insert(int l, int r, int x)
{
	b[l] += x;
	b[r + 1] -= x;
}
int main()
{
	int minn = 110;
	int n, p;
	cin >> n >> p;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		insert(i, i, a[i]);
	while (p--)
	{
		int x, y, z;
		cin >> x >> y >> z;
		insert(x, y, z);
	}
	for (int i = 1; i <= n; i++)
	{
		b[i] += b[i - 1];
		minn = min(minn, b[i]);
	}
	cout<<minn;
}